home *** CD-ROM | disk | FTP | other *** search
/ Eagles Nest BBS 7 / Eagles_Nest_Mac_Collection_Disc_7.TOAST / General Communication / USRv34ARA20 / USR2_0.ARA next >
Text File  |  1994-09-20  |  9KB  |  477 lines

  1. !  USRobotics ARA 2.0 Modem Script
  2. !  8/8/94 - 15:19
  3. !
  4. !  This script should work with any of our modems using our current
  5. !  command-set.  This would include all of our 9600, 14400, and 28800
  6. !  bps modems.  There is a display problem in that the results do not
  7. !  appear correctly in the interactive display window.  They will appear
  8. !  correctly in the logfile.
  9. !
  10. !  'mlts' resource info for this modem:
  11. !    byte 1 == 01 -> modem HAS builtin reliability protocols
  12. !    byte 2 == 00 -> reserved by Apple
  13. !    byte 3 == 21 -> max hex chars in varstr 7 (33 dec)
  14. !    byte 4 == 21 -> max hex chars in varstr 8
  15. !    byte 5 == 21 -> max hex chars in varstr 9
  16. !       
  17. @ORIGINATE
  18. @ANSWER
  19. !
  20. ! set up the modem - label range is 1-10
  21. !
  22. ! Mac talks to the modem at 57,600 bps.  
  23. serreset 57600, 0, 8, 1
  24. !
  25. ! reset the serial port
  26. HSReset 0 1 0 0 0 0
  27. settries 0
  28. !
  29. @LABEL 1
  30. matchclr
  31. matchstr 1 3 "OK\13\10"
  32. ! &F  - recall factory settings
  33. ! &D0 - Over-ride DTR for Hardware Handshaking Cables.
  34. ! &H1&R2 - Enable CTS/RTS Hardware flow control
  35. ! &B1 - Disable autobaud/lock DTE
  36. ! S0=0 - Don't answer calls
  37. ! E0V1Q0   - Turn command echo off/Enable Verbose responses
  38. ! &M0 - Enter normal mode (no reliability protocols)
  39. write "AT&F&D0&H1&R2&B1&A0S0=0E0V1Q0&M0&A3\13"
  40. matchread 15
  41. inctries
  42. iftries 2 71
  43. !
  44. ! Reset the Modem
  45. !
  46. write "+++"
  47. pause 5
  48. write "ATH\13"
  49. pause 5
  50. DTRSet
  51. flush
  52. jump 1
  53. !
  54. @LABEL 3
  55. ! Modem responding & configured.
  56. ! determine if reliable link is requested.
  57. !
  58. ! if modem mnp10 (v.42bis) link requested (var 4 == 2) then jump label 4
  59. ifstr 4 4 "2"
  60. !
  61. ! if modem v42 link requested (var 4 == 1) then jump label 5
  62. ifstr 4 5 "1"
  63. !
  64. ! if no modem v42 link requested (var 4 == 0) [same as ARA 1.0] then jump label 9
  65. ifstr 4 9 "0"
  66. !
  67. ! else invalid value in var 4; exit w/error
  68. jump 76
  69. !
  70. @LABEL 4
  71. ! THIS modem doesn't support mnp 10 links.
  72. ! It's used here to easily allow users to
  73. ! enable V.42bis.
  74. Note "MNP10 not available. Enabling V.42bis" 3
  75. !
  76. @LABEL 5
  77. ! yes, v42 link is requested.  OK for LAP-M -> MNP 4.
  78. matchclr
  79. matchstr 1 7 "OK\13\10"
  80. ! &A3 == gives PROTOCOL: and CONNECT result codes
  81. ! &M4 == v42 autoreliable mode
  82. ! &K3 == MNP 5 disabled, v42bis enabled 
  83. ! &K0 == Data Compression disabled 
  84. write "AT&A3&M4&K0\13"
  85. matchread 300
  86. jump 71
  87. !
  88. @LABEL 7
  89. ! ARA is supposed to do a better job of compression than v.42bis, 
  90. ! however, should you wish to try it, you may select MNP10 
  91. ! in Remote Access Setup and this script will enable v.42bis.
  92. ! (USR modems do not support MNP10 compression)
  93. ifstr 4 8 "2"
  94. jump 9
  95. @LABEL 8
  96. matchclr
  97. matchstr 1 9 "OK\13\10"
  98. ! &A3 (dec) adds COMPRESSION: result codes
  99. ! &K1 == MNP 5 and v42b enabled
  100. ! &K3 == v42b enabled, MNP-5 disabled
  101. write "AT&A3&K3\13"
  102. matchread 300
  103. jump 71
  104. !
  105. @LABEL 9
  106. ! If speaker on flag is true, jump to label 13.  Else turn off the speaker.
  107. ifstr 2 13 "1"
  108. pause 5
  109. matchclr
  110. matchstr 1 13 "OK\13\10"
  111. write "ATM0\13"
  112. matchread 30
  113. jump 71
  114. !
  115. ! modem ready, so enable answering or originate a call - label range is 11-30
  116. !
  117. @LABEL 13
  118. pause 5
  119. ifANSWER 62
  120. !
  121. ! if normal dialing (parm 6 == 0) jump to 19
  122. ifstr 6 19 "0"
  123. !
  124. ! if blind dialing (parm 6 == 1) jump to 17
  125. ifstr 6 17 "1"
  126. !
  127. ! if manual dialing (parm 6 == 2) jump to 15 
  128. ifstr 6 15 "2"
  129. !
  130. ! else invalid value in var 6; exit w/error
  131. jump 76
  132. !
  133. @label 15
  134. note "Manual dialing initiated" 3
  135. ! X1 to ignore dialtone & busy for manual dialing, D to dial
  136. write "ATX1D \13"
  137. jump 32
  138. !
  139. @label 17
  140. note "Dialing without tone" 3
  141. matchclr
  142. matchstr 1 19 "OK\13\10"
  143. ! X1 to ignore dialtone & busy for blind dialing
  144. write "ATX1\13"
  145. matchread 30
  146. jump 71
  147. !
  148. @label 19
  149. ! this is where we break up long dialstrings
  150. !
  151. ! parm 1 is always the full dialstring from the conn doc
  152. note "Dialing ^1" 3
  153. ! parm 3 is always "p" for pulse & "t" for tone
  154. !
  155. ! if parm 8 == blank (complete dialstring in parm 7)
  156. !  then jump to label 27 & dial parm 7
  157. ifstr 8 27 " "
  158. !
  159. ! if parm 9 == blank (complete dialstring in parms 7 & 8)
  160. !  then jump to label 24 & dial parm 7 & 8
  161. ifstr 9 24 " "
  162. !
  163. !  else dial parm 7 & 8 & 9 (complete dialstring in parms 7, 8 & 9)
  164. matchclr
  165. matchstr 1 21 "OK\13\10"
  166. ! parm 7 holds first string fragment
  167. write "ATD^3^7;\13"
  168. matchread 400
  169. ! modem not responding; bailout.
  170. jump 71
  171. @label 21
  172. ! parm 8 holds second string fragment
  173. matchclr
  174. matchstr 1 22 "OK\13\10"
  175. write "ATX3D^3^8;\13"
  176. matchread 400
  177. ! modem not responding; bailout.
  178. jump 71
  179. @label 22
  180. ! parm 9 holds last string fragment
  181. write "ATX3D^3^9\13"
  182. jump 32
  183. !
  184. @label 24
  185. matchclr
  186. matchstr 1 25 "OK\13\10"
  187. ! parm 7 holds first string fragment
  188. write "ATD^3^7;\13"
  189. matchread 400
  190. ! modem not responding; bailout.
  191. jump 71
  192. @label 25
  193. ! parm 8 holds last string fragment
  194. write "ATX3D^3^8\13"
  195. jump 32
  196. !
  197. @label 27
  198. ! parm 7 holds entire string
  199. write "ATD^3^7\13"
  200. jump 32
  201. !
  202. !    connecting - label range is 31-60
  203. !
  204. @LABEL 32
  205. !  The extra trapping for 1200 bps connections are due to a problem
  206. !  catching 12000 bps connections.  I chose to check for 1200 twice
  207. !  instead of checking for 12000 before 1200.
  208. !
  209. matchclr
  210. matchstr 1  34 "CONNECT 1200\13\10"
  211. matchstr 2  35 "CONNECT 1200/ARQ"
  212. matchstr 3  36 "CONNECT 2400"
  213. matchstr 4  37 "CONNECT 4800"
  214. matchstr 5  38 "CONNECT 7200"
  215. matchstr 6  39 "CONNECT 9600"
  216. matchstr 7  40 "CONNECT 12000"
  217. matchstr 8  41 "CONNECT 14400"
  218. matchstr 9  42 "CONNECT 16800"
  219. matchstr 10 43 "CONNECT 19200"
  220. matchstr 11 44 "CONNECT 21600"
  221. matchstr 12 45 "CONNECT 24000"
  222. matchstr 13 46 "CONNECT 26400"
  223. matchstr 14 47 "CONNECT 28800"
  224. matchstr 15 72 "NO DIAL TONE\13\10"
  225. matchstr 16 73 "NO CARRIER\13\10"
  226. matchstr 17 74 "BUSY\13\10"
  227. matchstr 18 75 "NO ANSWER\13\10"
  228. matchstr 19 73 "ERROR\13\10"
  229. matchstr 20 68 "RING\13\10"
  230. matchread 700
  231. ifANSWER 32
  232. jump 71
  233. !
  234. !  THIS v32b modem has been setup to do cts handshaking,
  235. !  and we assume that a cts handshaking cable is being used,
  236. !  so we leave the serial port set to 57,600 bps.
  237. @LABEL 34
  238. note "Communicating at 1200 bps." 3
  239. CommunicatingAt 1200
  240. jump 48
  241. !
  242. @LABEL 35
  243. note "Communicating at 1200 bps." 3
  244. CommunicatingAt 1200
  245. jump 49
  246. !
  247. @LABEL 36
  248. note "Communicating at 2400 bps." 3
  249. CommunicatingAt 2400
  250. jump 48
  251. !
  252. @LABEL 37
  253. note "Communicating at 4800 bps." 3
  254. CommunicatingAt 4800
  255. jump 48
  256. !
  257. @LABEL 38
  258. note "Communicating at 7200 bps." 3
  259. CommunicatingAt 7200
  260. jump 48
  261. !
  262. @LABEL 39
  263. note "Communicating at 9600 bps." 3
  264. CommunicatingAt 9600
  265. jump 48
  266. !
  267. @LABEL 40
  268. note "Communicating at 12000 bps." 3
  269. CommunicatingAt 12000
  270. jump 48
  271. !
  272. @LABEL 41
  273. note "Communicating at 14400 bps." 3
  274. CommunicatingAt 14400
  275. jump 48
  276. !
  277. @LABEL 42
  278. note "Communicating at 16800 bps." 3
  279. CommunicatingAt 16800
  280. jump 48
  281. !
  282. @LABEL 43
  283. note "Communicating at 19200 bps." 3
  284. CommunicatingAt 19200
  285. jump 48
  286. !
  287. @LABEL 44
  288. note "Communicating at 21600 bps." 3
  289. CommunicatingAt 21600
  290. jump 48
  291. !
  292. @LABEL 45
  293. note "Communicating at 24000 bps." 3
  294. CommunicatingAt 24000
  295. jump 48
  296. !
  297. @LABEL 46
  298. note "Communicating at 26400 bps." 3
  299. CommunicatingAt 26400
  300. jump 48
  301. !
  302. @LABEL 47
  303. note "Communicating at 28800 bps." 3
  304. CommunicatingAt 28800
  305. jump 48
  306. !
  307. ! v42 link connections.
  308. ! userhook 2 tells ARA that a modem-to-modem error correcting protocol has been negotiated
  309. ! userhook 4 would tell ARA that a modem-to-modem mnp 10 protocol has been negotiated
  310. !
  311. @LABEL 48
  312. pause 3
  313. matchclr
  314. matchstr 1 49 "/ARQ"
  315. matchstr 2 57 "\13\10"
  316. matchstr 3 57 "/NONE\13\10"
  317. matchread 30
  318. !
  319. @LABEL 49
  320. matchclr
  321. matchstr 1 50 "/LAPM"
  322. matchstr 2 51 "/MNP"
  323. matchread 30
  324. jump 58
  325. !
  326. @LABEL 50
  327. note "Established Error-Correcting V.42 link." 3
  328. USERHOOK 2
  329. jump 52
  330. !
  331. @LABEL 51
  332. note "Established Error-Correcting MNP link." 3
  333. USERHOOK 2
  334. jump 52
  335. !
  336. @LABEL 52
  337. matchclr
  338. ! "MNP5" shouldn't be attainable with this current script, but
  339. ! I am including this result trap in case a user wishes to enable it.
  340. matchstr 1 53 "/MNP5\13\10"
  341. matchstr 2 54 "/V42BIS\13\10"
  342. matchstr 3 56 "/NONE\13\10"
  343. matchread 30
  344. jump 58
  345. !
  346. @LABEL 53
  347. note "Established Data-Compressing MNP5 link." 3
  348. USERHOOK 4
  349. jump 58
  350. !
  351. @LABEL 54
  352. note "Established Data-Compressing V.42bis link." 3
  353. USERHOOK 4
  354. jump 58
  355. !
  356. @LABEL 56
  357. note "No DC link. Using built-in ARA Compression routines." 3
  358. jump 58
  359. @LABEL 57
  360. note "No EC or DC link. Using built-in ARA routines." 3
  361. !
  362. @LABEL 58
  363. ! Ensuring cts handshaking enabled.
  364. note "Turning on CTS Handshaking" 3
  365. HSReset 0 1 0 0 0 0
  366. !
  367. ifANSWER 59
  368. pause 30
  369. @LABEL 59
  370. exit 0
  371. !
  372. ! @ANSWER
  373. ! Set the modem to answer on 1st ring - label range is 61-70
  374. !
  375. @LABEL 62
  376. matchclr
  377. matchstr 1 32 "OK\13\10"
  378. write "ATS0=1\13"
  379. matchread 30
  380. jump 71
  381. !
  382. @LABEL 68
  383. ifORIGINATE 32
  384. ! claim the serial port
  385. userhook 1
  386. note "Answering phone..." 2
  387. jump 32
  388. !
  389. ! error messages - label range is 71-100
  390. !
  391. ! Modem Not Responding
  392. @LABEL 71
  393. exit -6019
  394. !
  395. ! No Dial Tone
  396. @LABEL 72
  397. exit -6020
  398. !
  399. ! No Carrier or Error
  400. @LABEL 73
  401. exit -6021
  402. !
  403. ! Busy
  404. @LABEL 74
  405. exit -6022
  406. !
  407. ! No Answer
  408. @LABEL 75
  409. exit -6023
  410. !
  411. ! varstring invalid value
  412. @LABEL 76
  413. exit -6027
  414. !
  415. ! Hang up the modem - label range is 101-120
  416. !
  417. @HANGUP
  418. @LABEL 102
  419. settries 0
  420. serreset 57600, 0, 8, 1
  421. HSReset 0 0 0 0 0 0
  422. @LABEL 105
  423. !
  424. ! Try to get control of the modem.
  425. !
  426. DTRSet
  427. pause 5
  428. DTRClear
  429. flush
  430. !
  431. @LABEL 108
  432. flush
  433. matchclr
  434. matchstr 1 111 "NO CARRIER\13\10"
  435. matchstr 2 111 "OK\13\10"
  436. matchstr 3 111 "ERROR\13\10"
  437. write "ATH\13"
  438. matchread 30
  439. inctries
  440. iftries 3 71
  441. DTRSet
  442. pause 5
  443. DTRClear
  444. pause 5
  445. DTRSet
  446. flush
  447. !
  448. @LABEL 109
  449. matchclr
  450. matchstr 1 115 "OK\13\10"
  451. write "+++"
  452. matchread 15
  453. jump 108
  454. !
  455. ! recall the factory settings.
  456. !
  457. @LABEL 111
  458. pause 15
  459. matchclr
  460. matchstr 1 114 "OK\13\10"
  461. write "AT&F&D0E0V1Q0S0=0\13"
  462. matchread 30
  463. jump 71
  464. !
  465. @LABEL 114
  466. exit 0
  467.  
  468. @LABEL 115
  469. pause 50
  470. jump 108
  471.  
  472. !
  473. ! labels 121-128 are reserved for future emergency hacks
  474. !
  475.